package com.itheima.map;

import java.util.Map;
import java.util.TreeMap;

public class Demo02 {

    public static void main(String[] args) {
        Map<String ,String> map= new TreeMap<>();
        map.put("马蓉","宝强");
        map.put("马蓉","宋喆");
        map.put("小璐","乃亮");
        map.put("小璐","PGone");
        map.put("杨幂","凯威");
        map.put("某某某","凯威");

        //V   remove(Object key)
        //根据键删除键值对元素
        String songzhe = map.remove("马蓉");
        System.out.println(songzhe);
        System.out.println(map);
        map.remove("小璐");
        System.out.println(map);

        //boolean containsKey(Object key)
        //判断集合是否包含指定的键
        System.out.println(map.containsKey("小璐"));
        System.out.println(map.containsKey("杨幂"));
        //boolean containsValue(Object value)
        System.out.println(map.containsValue("宝强"));
        System.out.println(map.containsValue("宋喆"));
        System.out.println(map.containsValue("凯威"));

        //判断集合是否包含指定的值
        //
        //boolean isEmpty()
        System.out.println(map.isEmpty());
        //判断集合是否为空
        //
        //int size()
        //集合的长度，也就是集合中键值对的个数
        map.clear();
        System.out.println(map.size());
        //void   clear()
        //移除所有的键值对元素
        System.out.println(map.isEmpty());


    }
}
